/**
*    Copyright (C) 2008  Chase Kernan 
*    chase.kernan@gmail.com
*
*    This program is free software: you can redistribute it and/or modify
*    it under the terms of the GNU General Public License as published by
*    the Free Software Foundation, either version 3 of the License, or
*    (at your option) any later version.
*
*    This program is distributed in the hope that it will be useful,
*    but WITHOUT ANY WARRANTY; without even the implied warranty of
*    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
*    GNU General Public License for more details.
*
*    You should have received a copy of the GNU General Public License
*    along with this program.  If not, see <http://www.gnu.org/licenses/>.
* 
**/

package com.chasekernan.hxnova.core.races;

/**
    Enum containing the lesser racial traits.
**/
enum LRT {
    ImprovedFuelEfficiency;
}

/**
    Contains all of the data related to the lrts. Most of the functions take a
    LRT element and return some sort of data. 
    Note: Holds less data than the PRTSet as many of the LRT effects need to be
    hard coded.
**/
class LRTSet {
    
    /**
        The lrts are stored here in an ordered set so that the data can also
        be held in arrays.
    **/
    public static var LRT_LIST : Array<LRT> = [ImprovedFuelEfficiency];
    
    /**
        The point value costs of choosing a lrt.
    **/
    public static var COSTS : Array<Int> = [235];
    
    /**
        The description displayed in the race editor.
    **/
    public static var DESCRIPTIONS : Array<String> = ["This gives you the " + 
            "Fuel Mizer and Galaxy Scoop engines and increases your starting " +
            "Propulsion tech by 1 level. All engines use %15 less fuel."];
    
    public static var IMPROVED_FUEL_EFFICIENCY_ADJ : Float = 0.85;
    
    public static function getCost(lrt : LRT) : Int {
        for(i in 0...LRT_LIST.length) {
            if(LRT_LIST[i] == lrt) return COSTS[i];
        }
        
        throw "LRT lists missing " + lrt;
    }
    
    public static function getDescription(lrt : LRT) : String {
        for(i in 0...LRT_LIST.length) {
            if(LRT_LIST[i] == lrt) return DESCRIPTIONS[i];
        }
        
        throw "LRT lists missing " + lrt;
    }
    
    public static function getLRTByName(name : String) : LRT {
        for(i in LRT_LIST) {
            if(Std.string(i) == name) return i;
        }
        
        throw "No such lrt: "+name;
    }
    
}